import { Tools } from 'weaver-mobile';
import { catchApiError } from '../util/index';

// 日程日历查看我的日程
export const getMyWorkplanDatas = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/MyCalendar',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}

// 所有日程
export const getAllWorkplanDatas = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/AllCalendar',
    params: {...params, ismobile: 1}
  }
  return Tools.callApi(options).then(catchApiError);
}

// 相关关注
export const getAttentionData = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/getAttentionData',
    params: {...params, ismobile: 1}
  }
  return Tools.callApi(options).then(catchApiError);
}

// 下属日程
export const getUnderlining = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/getUnderlining',
    params: {...params, ismobile: 1}
  }
  return Tools.callApi(options).then(catchApiError);
}

// 添加关注
export const addAttention = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/addAttention',
    params: {...params, ismobile: 1}
  }
  return Tools.callApi(options).then(catchApiError);
}

// 取消关注
export const delAttention = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/delAttention',
    params: {...params, ismobile: 1}
  }
  return Tools.callApi(options).then(catchApiError);
}

// 同步日程类型
export const getWorkPlanType = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/base/getWorkPlanType',
    params: {...params, ismobile: 1}
  }
  return Tools.callApi(options).then(catchApiError);
}

// 检测是否有语音新建日程接口
export const getSemanticStatus = (params) => {
  let options = {
    method: 'POST',
    url: '/api/workplan/calendar/getSemanticStatus',
    params: {...params, ismobile: 1}
  }
  return Tools.callApi(options).then(catchApiError);
}

// 语音-请求跨域所需参数
export const getSemanticUrlAndParam = params => {
  let options = {
    method: 'POST',
    url: '/api/workplan/base/getSemanticUrlAndParam',
    params: {...params, ismobile: 1}
  };
  return Tools.callApi(options).then(catchApiError);
}
